FROM openjdk:8-jdk-alpine


ENV PINPOINT_VERSION=2.1.0
ENV SPRING_PROFILES=release

#本地无pinpoint-agent-${PINPOINT_VERSION}.tar.gz包 需要先下载到本地
COPY pinpoint-agent-${PINPOINT_VERSION}.tar.gz  /pinpoint-agent.tar.gz
COPY start.sh /apps/start.sh

RUN chmod a+x /apps/start.sh \
    && tar -zxvf /pinpoint-agent.tar.gz \
    && mv /pinpoint-agent-${PINPOINT_VERSION} /pinpoint-agent \
    && chmod -R o+x /pinpoint-agent \
    && rm -rf /pinpoint-agent.tar.gz

#子镜像要做的
ONBUILD ARG JAR_NAME


ONBUILD ENV COLLECTOR_IP=localhost \
    PROFILER_TRANSPORT_AGENT_COLLECTOR_PORT=9991 \
    PROFILER_TRANSPORT_METADATA_COLLECTOR_PORT=9991 \
    PROFILER_TRANSPORT_STAT_COLLECTOR_PORT=9992 \
    PROFILER_TRANSPORT_SPAN_COLLECTOR_PORT=9993 \
    PROFILER_SAMPLING_RATE=1 \
    DEBUG_LEVEL=INFO \
    PROFILER_TRANSPORT_SPAN_COLLECTOR_PORT=9993 \
    PROFILER_TRANSPORT_MODULE=GRPC \
    COLLECTOR_TCP_PORT=9994 \
    COLLECTOR_STAT_PORT=9995 \
    COLLECTOR_SPAN_PORT=9996 \
    JAVA_OPS="" \
    PINPOINT_AGENT_ID=test \
    PINPOINT_APP_NAME=test \
    JAR_NAME=${JAR_NAME} \
    CONFIG_OPS=""

ONBUILD COPY target/${JAR_NAME}.jar /apps/${JAR_NAME}/app.jar
ONBUILD ENTRYPOINT sh /apps/start.sh
